import 'package:dailoz/constants.dart';
import 'package:dailoz/generated/l10n.dart';
import 'package:dailoz/size_config.dart';
import 'package:dailoz/views/login.dart';
import 'package:dailoz/views/sign_up.dart';
import 'package:dailoz/widgets/button_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class Splash extends StatelessWidget {
  const Splash({Key? key}) : super(key: key);

  static String id = 'splash_view';

  @override
  Widget build(BuildContext context) {
    return const SplashScaffold();
  }
}

class SplashScaffold extends StatelessWidget {
  const SplashScaffold({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    SizeConfig.init(context, 390, 844);
    return Scaffold(
      resizeToAvoidBottomInset: false,
      body: Center(
        child: SizedBox(
          width: SizeConfig.getProportionateScreenWidth(315.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              SizedBox(
                height: SizeConfig.getProportionateScreenHeight(120.0),
              ),
              Image.asset(
                "assets/images/Dailoz.png",
                height: SizeConfig.getProportionateScreenHeight(294.0),
                width: SizeConfig.getProportionateScreenWidth(291.0),
              ),
              Padding(
                padding: EdgeInsets.only(
                  top: SizeConfig.getProportionateScreenHeight(20.0),
                ),
                child: Text(
                  S.of(context).splashTitle,
                  style: Theme.of(context).textTheme.bodyText1?.copyWith(
                        fontSize: SizeConfig.getProportionateFontSize(32.0),
                      ),
                ),
              ),
              Padding(
                padding: EdgeInsets.only(
                  top: SizeConfig.getProportionateScreenHeight(40.0),
                ),
                child: Text(
                  S.of(context).splashContent,
                  style: Theme.of(context)
                      .textTheme
                      .bodyText1
                      ?.copyWith(fontSize: 14.0),
                  textAlign: TextAlign.center,
                ),
              ),
              ButtonWidget(
                width: 304.0,
                height: 52.0,
                buttonText: S.of(context).loginButtonText,
                onPressed: () {
                  Navigator.pushNamed(context, Login.id);
                },
                buttonColor: buttonWidgetColor,
                buttonTextColor: Colors.white,
                padding: const EdgeInsets.only(top: 40.0),
              ),
              ButtonWidget(
                width: 304.0,
                height: 52.0,
                buttonText: S.of(context).signUpButtonText,
                buttonTextColor: const Color(0xff5B67CA),
                onPressed: () {
                  Navigator.pushNamed(context, SignUp.id);
                },
                padding: const EdgeInsets.only(top: 23.0),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
